|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectalgalcommand.alpha.Photobioreactor
public class Photobioreactor
| Field Summary | |
|---|---|
static java.lang.String |
COMMAND_PREFIX
This is the prefix that the PBRBrain uses to differentiate commands from other stuff that it receives from its serial input |
static java.lang.String |
COMMAND_SUFFIX
The suffix is used by the PBRBrain to know when to parse the input command (actually, the PBRBrain is usually smart enough to not need this, but that behavior is not a design spec., so that may not always be true). |
protected java.io.BufferedReader |
input
The input stream is an object for receiving data (usually text) from something else's output. |
protected java.io.PrintWriter |
output
The output stream is an object for sending data (usually text) out to a destination (such as a file, or in this case, a network connection). |
static int |
PBR_PORT
This is the port number for talking to the PBRs |
static java.lang.String |
TAGNAME
|
static int |
TIMEOUT_MS
|
| Constructor Summary | |
|---|---|
Photobioreactor()
Default constructor, sets all values to null. |
|
Photobioreactor(java.lang.String ipaddress)
Constructor plus initialization from network address |
|
| Method Summary | |
|---|---|
void |
addPBRListener(PBRDataListener l)
Adds a PBRListener to this object. |
java.util.List<Photobioreactor> |
getByName(java.lang.String name,
boolean casesensitive,
Photobioreactor... reactors)
Scans through the given list of photobioreactors and returns all of those whose name matches the given name. |
java.lang.String |
getMAC()
The PBRBrain has no way of seeing its own MAC address, but its ethernet module transmits its MAC during network discovery. |
java.lang.String |
getName()
|
void |
initializeFromAddress(java.lang.String ipaddress)
Initializes this Photobioreactor by connecting it to the provided host address (which presumably is the Lantronix Ethernet module of a PBR). |
static void |
main(java.lang.String[] args)
just for code testing purposes |
void |
removeAllPBRListeners()
Removes all PBRListeners currently registered with this object |
void |
removePBRListener(PBRDataListener l)
Removes a PBRListener from this object. |
protected void |
sendCommand(java.lang.String command)
Formats the given command to PBR command notation (basically add '>' as a prefix) and sends it down the provided output stream. |
protected static void |
sendCommand(java.lang.String command,
java.io.PrintWriter out)
Formats the given command to PBR command notation (basically add '>' as a prefix) and sends it down the provided output stream |
void |
setMAC(java.lang.String newmac)
The PBRBrain has no way of seeing its own MAC address, but its ethernet module transmits its MAC during network discovery. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String TAGNAME
public static final int TIMEOUT_MS
public static final int PBR_PORT
protected java.io.PrintWriter output
protected java.io.BufferedReader input
public static final java.lang.String COMMAND_PREFIX
public static final java.lang.String COMMAND_SUFFIX
| Constructor Detail |
|---|
public Photobioreactor()
initializeFromAddress(address) to fill in the values from a
network location.
public Photobioreactor(java.lang.String ipaddress)
throws java.net.UnknownHostException,
java.io.IOException,
java.lang.InterruptedException,
java.lang.IllegalArgumentException
ipaddress - Network address of the PBR unit that this object
should represent.
java.net.UnknownHostException - If ipaddress was not valid or
not found.
java.io.IOException - If errors occurred while trying to communicate with
the device.
java.lang.InterruptedException - If this thread was interrupted while trying
to connect.
java.lang.IllegalArgumentException - If the device exists, but is not a PBR
(it doesn't respond appropriately to PBR commands).| Method Detail |
|---|
public void setMAC(java.lang.String newmac)
newmac - MAC address from the Lantronix modulepublic java.lang.String getMAC()
public final void initializeFromAddress(java.lang.String ipaddress)
throws java.net.UnknownHostException,
java.io.IOException,
java.lang.InterruptedException,
java.lang.IllegalArgumentException
ipaddress - Network address of the PBR unit that this object
should represent.
java.net.UnknownHostException - If ipaddress was not valid or
not found.
java.io.IOException - If errors occurred while trying to communicate with
the device.
java.lang.InterruptedException - If this thread was interrupted while trying
to connect.
java.lang.IllegalArgumentException - If the device exists, but is not a PBR
(it doesn't respond appropriately to PBR commands).public java.lang.String toString()
toString in class java.lang.Object
protected static void sendCommand(java.lang.String command,
java.io.PrintWriter out)
throws java.io.IOException
command - The command to send (e.g. setSolarLED(2.5));out - An output stream to the PBR
java.io.IOException - thrown if there was a problem with the output streamprotected void sendCommand(java.lang.String command)
command -
java.io.IOException
public java.util.List<Photobioreactor> getByName(java.lang.String name,
boolean casesensitive,
Photobioreactor... reactors)
name - Name of the Photobioreactor that you want to findcasesensitive - Whether or not to match casesreactors - An array or list of Photobioreactors
public java.lang.String getName()
public void addPBRListener(PBRDataListener l)
l - A PBRListener object that wants to handle incoming datapublic void removePBRListener(PBRDataListener l)
l - A PBRListener object that was handling incoming datapublic void removeAllPBRListeners()
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||